package com.yaoandw.crawl.task;

import org.apache.commons.logging.LogFactory;

import com.yaoandw.crawl.threading.WorkerThreadPool;


public class DispatchSpiderTasks  implements DispatcherTask {
    protected WorkerThreadPool spiders;
    protected boolean running;
    public DispatchSpiderTasks(WorkerThreadPool spiders) {
        this.spiders = spiders;
        running = true;
    }

    public void execute() {
        LogFactory.getLog(DispatchSpiderTasks.class).debug("Spider task dispatcher running ...");
        while (running) {
//            try {
//                spiders.assign(agent.getSpiderTask());
//            } catch (NoSuitableItemFoundException e) {
//            } catch (SpideringDoneException e) {
//                running = false;
//            } catch (TaskAssignmentException e) {
//                // We dealt with all subclasses, so this shouldn't happen !!!
//            }
        }
        LogFactory.getLog(DispatchSpiderTasks.class).debug("Spider task dispatcher dying ...");

    }

}
